﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using NHibernate;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;

namespace SmartProject.Data
{
    public class MySQL : DataProvider
    {
        protected void KeywordFix(NHibernate.Cfg.Configuration configuration)
        {
            configuration.SetProperty(NHibernate.Cfg.Environment.Hbm2ddlKeyWords, "none"); 
        }

        protected override ISessionFactory CreateSessionFactory()
        {
            return Fluently.Configure()
                .Database(MySQLConfiguration.Standard.ConnectionString(base.ConnectionString))
                .Mappings(m => m.FluentMappings.AddFromAssemblyOf<DataProvider>())
                .ExposeConfiguration(BuildSchema)
                .ExposeConfiguration(KeywordFix)
                .BuildSessionFactory();
        }
    }
}
